#include <iostream >
using namespace std;
class B {
protected:
  int i, j;
public:
  void se(int a, int b) {
     i = a;
     j = b;
  }
  void sh() {
     cout << i << " " << j << endl;
  }
};
class D1 : public B {
  int k;
public:
  void sek() {
     k = i*j;
  }
  void shk() {
     cout << k << endl;
  }
};


class D2 : public D1 {
  int m;
public:
  void sem() {
     m = i-j;
  }
  void shm() {
     cout << m << endl;
  }
};

int main()
{
  D1 obj1;
  D2 obj2;

  obj1.se(2, 3);
  obj1.sh();
  obj1.sek();
  obj1.shk();
  obj2.se(3, 4);
  obj2.sh();
  obj2.sek();
  obj2.sem();
  obj2.shk();
  obj2.shm();
  return 0;
}
